package com.itcast.Service;

import com.itcast.config.SpringConfig;
import com.itcast.domain.Book;
import org.junit.jupiter.api.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;

import java.util.List;

@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(classes = SpringConfig.class)
public class ServiceTest {
    //如果写成实现类,一般情况也没问题
    //但是在aop场景就出问题了
    @Autowired
    BookService service;

    @Test
    public void test01(){
        List<Book> all = service.getAll();
        System.out.println(all);
    }
}